﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace TimeClockLib
{
    /// <summary>
    /// Interaction logic for InPageDialog.xaml
    /// </summary>
    public partial class InPageDialog : UserControl, INotifyPropertyChanged 
    {
        public InPageDialog()
        {
            InitializeComponent();
        }
        public void Show(IDialog ucContent)
        {
            //this.ContentArea2.Child = null;
            //ucContent.OnClose += new Action<object>(ucContent_OnClose);
            //var uc = ucContent as UserControl;
            //this.tBlurRadius = uc.Width + 30;
            //this.ContentArea2.Child = uc;
            //this.Visibility = Visibility.Visible;
            
        }

        void ucContent_OnClose(object obj)
        {
            //this.Visibility = Visibility.Collapsed;
            //this.ContentArea2.Child = null;
            
        }
        protected virtual void Changed(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public static readonly DependencyProperty ContentBackgroundProperty = DependencyProperty.Register("ContentBackground", typeof(Brush), typeof(InPageDialog), new UIPropertyMetadata(Brushes.White));
        public Brush ContentBackground 
        {
            get { return (Brush)GetValue(ContentBackgroundProperty); }
            set { SetValue(ContentBackgroundProperty, value); }
        }

        public static readonly DependencyProperty ContentBorderBrushProperty = DependencyProperty.Register("ContentBorderBrush", typeof(Brush), typeof(InPageDialog), new UIPropertyMetadata(Brushes.White));
        public Brush ContentBorderBrush 
        {
            get { return (Brush)GetValue(ContentBorderBrushProperty); }
            set { SetValue(ContentBorderBrushProperty, value); }
        }

        public static readonly DependencyProperty ContentActiveBackgroundProperty = DependencyProperty.Register("ContentActiveBackground", typeof(Brush), typeof(InPageDialog), new UIPropertyMetadata(Brushes.White));
        public Brush ContentActiveBackground 
        {
            get { return (Brush)GetValue(ContentActiveBackgroundProperty); }
            set { SetValue(ContentActiveBackgroundProperty, value); }
        }

        public static readonly DependencyProperty ContentBorderThicknessProperty = DependencyProperty.Register("ContentBorderThickness", typeof(Thickness), typeof(InPageDialog));
        public Thickness ContentBorderThickness 
        {
            get { return (Thickness)GetValue(ContentBorderThicknessProperty); }
            set { SetValue(ContentBorderThicknessProperty, value); }
        }

        public static readonly DependencyProperty ContentBlurRadiusProperty = DependencyProperty.Register("ContentBlurRadius", typeof(double), typeof(InPageDialog));
        public double ContentBlurRadius 
        {
            get { return (double)GetValue(ContentBlurRadiusProperty); }
            set { SetValue(ContentBlurRadiusProperty, value); }
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }

    public interface IDialog
    {
        event Action<object> OnClose;
    }
}
